package org.coco24.pmgame.pack


import com.badlogic.gdx.graphics.Color

/**
 * Created by coco24 on 17-8-19.
 */

enum class Status
{
    NORMAL, POISON, BADLY_POISON, PARALYSIS, SLEEP, BURN, FREEZE, FAINTED;

    companion object
    {
        @JvmStatic
        fun getText(status: Status): String
        {

            when (status)
            {
                NORMAL -> return "　　"
                POISON -> return "中毒"
                BADLY_POISON -> return "剧毒"
                PARALYSIS -> return "麻痹"
                SLEEP -> return "睡眠"
                BURN -> return "灼伤"
                FREEZE -> return "冰冻"
                FAINTED -> return "濒死"
                else -> return "???"
            }

        }

        @JvmStatic
        fun getColor(status: Status): Color
        {
            when (status)
            {
                NORMAL -> return Color.WHITE
                POISON -> return Color.PURPLE
                BADLY_POISON -> return Color.PURPLE
                PARALYSIS -> return Color.YELLOW
                SLEEP -> return Color.GRAY
                BURN -> return Color.ORANGE
                FREEZE -> return Color.SKY
                FAINTED -> return Color.RED
                else -> return Color.WHITE
            }
        }

        @JvmStatic
        fun valueof(status: String): Status
        {
            return when (status.toUpperCase())
            {
                "NORMAL" -> NORMAL
                "POISON" -> POISON
                "BADLY_POISON" -> BADLY_POISON
                "PARALYSIS" -> PARALYSIS
                "SLEEP" -> SLEEP
                "BURN" -> BURN
                "FREEZE" -> FREEZE
                "FAINTED" -> FAINTED
                else -> NORMAL
            }
        }

        @JvmStatic
        fun getFromInt(statusI: Int): Status
        {
            for (status in Status.values())
            {
                if (statusI == status.ordinal) return status
            }
            return NORMAL
        }
    }
}
